<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>小孟进销存系统</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link href="../static/css/animate.min.css" th:href="@{/css/animate.min.css}" rel="stylesheet"/>
    <link href="../static/css/style.min.css" th:href="@{/css/style.min.css}" rel="stylesheet"/>
    <style>
        .fixed-table-loading{
            display: none;
        }
        /* 隐藏标题栏中的logo */
        favicon.ico {
            display: none;
        }
    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content">

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 id="orderId_txt">本月订单统计</h5>
                    <div class="pull-right">
                        <div class="btn-group">
                            <!--                            <button type="button" class="btn btn-xs btn-white active">天</button>-->
                            <!--                            <button type="button" class="btn btn-xs btn-white">月</button>-->
                            <!--                            <button type="button" class="btn btn-xs btn-white">年</button>-->
                        </div>
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="row" >
                        <div class="col-sm-3">
                            <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <span class="label label-success pull-right"></span>
                                <span>采购入库金额</span>
                            </div>
                            <div class="ibox-content">
                                <h1 class="no-margins" id="buyTotalMoney">0</h1>
                            </div>
                        </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="ibox float-e-margins">
                                <div class="ibox-title">
                                    <span class="label label-primary pull-right"></span>
                                    <span>销售出库金额</span>
                                </div>
                                <div class="ibox-content">
                                    <h1 class="no-margins" id="sellTotalMoney">0</h1>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="ibox float-e-margins">
                                <div class="ibox-title">
                                    <span class="label label-danger pull-right"></span>
                                    <span>利润</span>
                                </div>
                                <div class="ibox-content">
                                    <h1 class="no-margins" id="profitTotalMoney">0</h1>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

       </div>

    </div>

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>消息</h5>
                </div>
                <div class="ibox-content" style="height: 500px">
                    <div class="row" >
                        <div class="col-sm-12">
                            <div class="flot-chart">
                                <div class="flot-chart-content" id="flot-dashboard-chart" style="height: 500px">
                                    <div class="row">
                                        <div class="btn-group-sm" id="toolbar" role="group">
                                            <a class="btn btn-info single disabled" onclick="$.operate.detail()" >
                                                <i class="fa fa-search"></i> 详细
                                            </a>
                                        </div>
                                        <div class="col-sm-12 select-table table-striped">
                                            <table id="bootstrap-table"></table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: echarts-js" />
<script type="text/javascript">
    $(function() {
        var options = {
            url: ctx + "index/notice/list",
            detailUrl: ctx + "system/notice/detail/{id}",
            modalName: "公告",
            showSearch: false,
            showPageGo: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            columns: [{
                checkbox: true
            },
                {
                    field : 'noticeId',
                    title : '序号'
                },
                {
                    field : 'noticeTitle',
                    title : '公告标题'
                },
                {
                    field : 'createBy',
                    title : '创建者',
                    visible: false,
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    visible: false,
                    formatter: function(value, row, index) {
                        var actions = [];
                      //  actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.noticeId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);

    });


    $(document).ready(function () {
        const formattedDate = new Date().toISOString().substr(0, 10);
        $("#orderId_txt").text(formattedDate.substring(0, 7) + " 月订单统计");
        $.post(ctx + "statistics/statisticsBuy/currentMonth?dateMonth=" + formattedDate, function (result) {
            if (result.code == 0) {
                let data = result.data || [];
                $("#buyTotalMoney").text(data.mallStoreTotalMoney || 0);
            }
        });

        $.post(ctx + "statistics/statisticsSell/currentMonth?dateMonth=" + formattedDate, function (result) {
            if (result.code == 0) {
                let data = result.data;
                $("#sellTotalMoney").text(data.sellStoreTotalMoney || 0);
                $("#profitTotalMoney").text(data.profitTotalMoney || 0);
            }
        });

        // $.post(ctx+"index/statistics/month",function (result) {
        //     if(result.code == 0){
        //         let data = result.data;
        //         $("#buyTotalMoney").text(data.buyTotalMoney);
        //         $("#sellTotalMoney").text(data.sellTotalMoney);
        //         $("#profitTotalMoney").text(data.profitTotalMoney);
        //         let option = {
        //             legend: {},
        //             tooltip: {},
        //             dataset: {
        //                 dimensions: ['month', '成本', '销售', '利润'],
        //                 source: data.items
        //             },
        //             xAxis: {type: 'category'},
        //             yAxis: {},
        //             series: [
        //                 {type: 'bar'},
        //                 {type: 'bar'},
        //                 {type: 'bar'}
        //             ]
        //         };
        //
        //         echarts.init(document.getElementById('flot-dashboard-chart')).setOption(option);
        //     }
        //
        // })


        // let option = {
        //     legend: {},
        //     tooltip: {},
        //     dataset: {
        //         dimensions: ['month', '成本', '销售', '利润'],
        //         source: [
        //             {month: '1月', '成本': 43.3, '销售': 85.8, '利润': 93.7},
        //             {month: '2月', '成本': 83.1, '销售': 73.4, '利润': 55.1},
        //             {month: '3月', '成本': 86.4, '销售': 65.2, '利润': 82.5},
        //             {month: '4月', '成本': 72.4, '销售': 53.9, '利润': 39.1}
        //         ]
        //     },
        //     xAxis: {type: 'category'},
        //     yAxis: {},
        //     series: [
        //         {type: 'bar'},
        //         {type: 'bar'},
        //         {type: 'bar'}
        //     ]
        // };
        //
        // echarts.init(document.getElementById('flot-dashboard-chart')).setOption(option);


    })
</script>
</body>
</html>
